<template>
	<view style="width: 750rpx;">
		<view class="item" @click="handleToDetail()">
			<image :src="item.cover" mode="aspectFit"></image>
			<view class="info">
				<view class="title one-text-ellipsis">{{item.title}}</view>
				<view class="num">
					<view class="line-h">
						<text class="iconfont iconbofangshu" style="margin-right: 8rpx;"></text>
						<text class="font-sm">{{item.play_count}}</text>
					</view>
					<view class="line-h">
						<text class="iconfont icondanmushu" style="margin-right: 8rpx;"></text>
						<text class="font-sm">{{item.danmu_count}}</text>
					</view>
					<text class="iconfont icongengduo"></text>
				</view>
			</view>
		</view>
		<view v-if="type==='video'">
			<view class="operate">
				<view @click="handleToCreate(item.id)">修改</view>
				<view @click="handleToVideo(item.id)">视频</view>
				<view @click="handleDeleteVideo(item.id)">删除</view>
			</view>
			<view class="separation-line"></view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['item', 'type'],
		methods: {
			handleToDetail(){
				uni.navigateTo({
					url:`/pages/detail_video/detail_video?id=${this.$props.item.id}`
				})
			},
			handleToCreate(id) {
				uni.navigateTo({
					url: `/pages/create/create?type=update&id=${id}`
				})
			},
			handleDeleteVideo(id) {
				this.$emit('deteleVideo',id)
			},
			handleToVideo(id){
				uni.navigateTo({
					url:`/pages/user-video-list/user-video-list?video_id=${id}`
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.item {
		display: flex;
		padding: 20rpx 0;
		border-bottom: 2rpx solid #ecebe9;

		image {
			padding: 0 20rpx;
			width: 260rpx;
			height: 160rpx;
		}

		.info {
			display: flex;
			justify-content: center;
			flex: 1;
			flex-direction: column;

			.title {
				font-size: 32rpx;
			}

			.num {
				padding-right: 10rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
			}
		}
	}

	.operate {
		display: flex;

		view {
			text-align: center;
			line-height: 90rpx;
			height: 90rpx;
			flex: 1;
		}
	}
</style>
